/**
 * 2017年5月18日
 */
package cn.edu.bjtu.net;

import java.net.SocketAddress;

import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.channel.ChannelPipelineFactory;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

/**
 * @author Alex
 *
 */
public abstract class Server {
	ServerBootstrap sbs =  null;
	SocketAddress sa = null;
	/**
	 * 
	 */
	public Server(SocketAddress sa) {
		sbs = new ServerBootstrap(new NioServerSocketChannelFactory());
	
		sbs.setPipelineFactory(getChannelPipelineFactory());
		
		this.sa = sa;
	}
	public void letsRun(){
		sbs.bind(sa);
	}
	public abstract ChannelPipelineFactory getChannelPipelineFactory();
	
	
}
